<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="layouts/main">
<div th:switch="${error_message_code}" class="island-landscape" layout:fragment="page-content">
    <div class="island-title">
        <h1>Create your <th:block th:text="${!companyName.equals('Cloud Foundry') and isUaa ? (companyName + ' account') : 'account'}">account</th:block></h1>
    </div>

    <div th:case = "'other_idp'" class="island-content">
        <div class="alert alert-error">
            <p th:text="#{'create_account.' + ${error_message_code}}">Error Message</p>
        </div>
        <form th:action="@{/login/idp_discovery}" method="post" novalidate="novalidate">
            <input type="hidden" name="email" th:value="${email}"/>
            <input type="submit" value="Login with provider" class="island-button"/>
        </form>
    </div>

    <div th:case = "*" class="island-content">
        <form th:action="@{/create_account.do}" method="post" novalidate="novalidate">
            <div th:if="${error_message_code}" class="alert alert-error">
                <p th:text="#{'create_account.' + ${error_message_code}}">Error Message</p>
            </div>
            <div th:if="${error_message}" class="alert alert-error">
                <p th:text="${error_message}">Error Message</p>
            </div>
            <input type="hidden" name="client_id" th:value="${client_id}"/>
            <input type="hidden" name="redirect_uri" th:value="${redirect_uri}"/>
            <input name="email" type="email" placeholder="Enter your email" autofocus="autofocus" required="required" class="form-control"/>
            <input name="password" type="password" required="required" placeholder="Password" autocomplete="off" class="form-control"/>
            <input name="password_confirmation" type="password" required="required" placeholder="Confirm" autocomplete="off" class="form-control"/>

            <label th:if="${consent_text}" style="margin-bottom: 20px">
                <input name="does_user_consent" type="checkbox" style="display: inline">
                <span>I agree to </span>
                <span th:if="!${consent_link}" th:text="${consent_text}"></span>
                <a th:if="${consent_link}" th:text="${consent_text}" name="consent-link" th:href="@{${consent_link}}" target="_blank"></a>
            </label>

            <input type="submit" value="Send activation link" class="island-button"/>
        </form>
    </div>

    <div class="island-footer">
        <a href="/login" th:href="@{/login}" class="link-lowlight">Already joined? Sign in.</a>
    </div>
</div>
</html>
